import { Injectable } from '@nestjs/common';
import { HttpException, HttpStatus } from '@nestjs/common';
@Injectable() // 此注解表示此服务可以被注入到其他类中
export class testService {
  getTestData(): string {
    return '读取数据成功';
  }
  getTest(id: string): string {
    const trimmedId = id.trim();
    if (!id || !Number.isInteger(Number(trimmedId))) {
      throw new HttpException('id不能为空且必须是整数', HttpStatus.BAD_REQUEST);
    }
    return `id:${trimmedId}`;
  }
  postTest(bodys: { id: string; name: string }, querys: any): string {
    return JSON.stringify({ body: bodys, query: querys });
  }
  deleteTest(id: string): string {
    return `id:${id}`;
  }
}
